﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using K.EnterpriseLibary.Entity;
using K.DLInterface;
namespace K.Service
{
    public class ChineseDictService
    {
        static private ChineseDictService instance; 
        private IChineseDict dal;

        private ChineseDictService()
        {
            //此处需要得到实现Idictionary接口的实例，即具体的数据层实例 
            dal = DataAccess.CreateChineseDict();
        }

         static public ChineseDictService Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new ChineseDictService();
                }
                return instance;
            }
        }

        //以下是关于持久层操作的服务方法

        public bool InsertCharacter(Character character)
        {
            return dal.InsertCharacter(character);
        }

        public bool UpdateCharacter(Character character)
        {
            return dal.UpdateCharacter(character);
        }

        public bool DeleteCharacter(Character character)
        {
            return dal.DeleteCharacter(character);
        }

        public Character GetRandomCharacter()
        {
            return dal.SelectRandomCharacter();
        }

        public bool InsertCharacterInfo(CharacterInfo characterInfo)
        {

            return dal.InsertCharacterInfo(characterInfo);
        }

        public bool InserCharacterInfoProvenance(CharacterInfoProvenance characterInfoProvenance)
        {
            return dal.InsertCharacterInfoProvenance(characterInfoProvenance);
        }

        public List<CharacterInfo> SelectCharacterInfoList(Character character)
        {
            return dal.SelectCharacterInfoByCharacter(character);
        }

        public bool DeleteCharacterInfoProvenance(CharacterInfoProvenance characterInfoProvenance)
        {
            return dal.DeleteCharacterInfoProvenance(characterInfoProvenance);
        }

        public bool DeleteCharacterInfo(CharacterInfo characterInfo)
        {
            return dal.DeleteCharacterInfo(characterInfo);        
        }
    }
}
